home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: clahey@ix.netcom.com(Chris Lahey )
- Newsgroups: comp.lang.c++
- Subject: how to redirect ostream output
- Date: 12 Apr 1996 22:13:20 GMT
- Organization: Netcom
- Message-ID: <4kmki0$19h@dfw-ixnews2.ix.netcom.com>
- NNTP-Posting-Host: dgr-il3-23.ix.netcom.com
- X-NETCOM-Date: Fri Apr 12 5:13:20 PM CDT 1996
-
- I am using a vendor's logging class that allows me to log to any
- ostream I pass to it or by default it will log to stderr. Rather than
- write to a specific file or output device, I would like to be able to
- recognize when a the string ends (by looking for a '\n') and then flush
- the buffer to a queue using a package we purchased.
-
- We are having trouble finding exactly where we need to put this logic.
- The ostream class does not have any virtual methods, so we thought that
- we should inherit from streambuf, since ostream's constructor is passed
- a streambuf. We weren't sure where to put our logic, so we overrode
- all of streambuf's virtual functions with a single cout << "I'm here"
- statement and then called the underlying streambuf function.
- Unfortunately we found that (at least in our implementation on AIX
- 4.1.x) none of the virtual functions were being called. So my question
- is:
-
- Where can we put this logic that will recognize when a '\n' is written
- to the ostream so we can flush the current buffer to our queue using
- the queue API's? If it is not by inheriting from ostream or streambuf,
- is there another class that we could inherit from to get the same
- results.
-
- Any help would be appreciated.
-
- Thanks in advance,
-
- Chris Lahey
- CCC Information Services
- Chicago
- clahey@ix.netcom.com
-